﻿<%@ page Title="" Language="C#" MasterpageFile="~/pgMaster.master" AutoEventWireup="true" CodeFile="bargraph_release.aspx.cs" Inherits="bargraph_release" %>

<asp:Content ID="Content1" ContentplaceHolderID="ContentplaceHolder1" Runat="Server">
    <script type="text/javascript" src="FusionCharts/FusionCharts.js" language="javascript"></script>
<script type="text/javascript" language="javascript">
    
    function open_piechart(project, release,system,pageopt) {
        var pieurl = "piechart.aspx?system=" + system + "&project=" + project + "&release=" + release + "&pt=" + pageopt;
        showPopWin(pieurl,800, 500, null); 
        return false;
    }

    function submit_form() {
        var project_name = "";
        k = 0;
        for (i = 0; i < document.aspnetForm.elements.length; i++) {
            if (document.aspnetForm.elements[i].type == "checkbox" && document.aspnetForm.elements[i].checked == true) {
                if (document.aspnetForm.elements[i].id != "select_all") {
                    var labelArray = document.aspnetForm.elements[i].parentElement.getElementsByTagName('label');
                    if (k == 0) {
                        project_name = "'" + labelArray[0].innerHTML + "'";
                    }
                    else {
                        project_name = project_name + ",'" + labelArray[0].innerHTML + "'";
                    }
                    k++;
                }
            }
        }
        window.document.getElementById('<%=hdnProject.ClientID%>').value = project_name;
    }

    function selectAll() {
        var allElts = document.forms['aspnetForm'].elements;
        var i;
        var chkelts = new Array();
        var j = 0;
        for (i = 0; i < allElts.length; i++) {
            var elt = allElts[i];
            if (elt.type == "checkbox") {
                chkelts[j] = elt.id;
                j = j + 1;
            }
        }
        var masterchkbx = document.aspnetForm.select_all;
        if (masterchkbx.checked == true) {
            for (i = 0; i < chkelts.length; i++) {
                var chkbx = window.document.getElementById(chkelts[i]);
                chkbx.checked = true;
                flag = true;
            }
        }
        else {
            for (i = 0; i < chkelts.length; i++) {
                var chkbx = window.document.getElementById(chkelts[i]);
                chkbx.checked = false;
                flag = false;
            }
        }
    }
</script>
    <table style="width:100%;">
        <tr>
            <td colspan="3">
                <strong><b><span style="COLOR: #cc0033; FONT-SIZE: 16pt">Defect Dashboard</span></b></strong></td>
        </tr>
        <tr>
            <td style="width: 296px">
                &nbsp;</td>
            <td style="width: 324px">
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td colspan="3">
                &nbsp; 
                <font face="Verdana" size="2" style="text-align: left"><strong>Select a System:&nbsp;
                <asp:DropDownList ID="ddSystem" runat="server" AppendDataBoundItems="true" 
                    AutoPostBack="True" onselectedindexchanged="ddSystem_SelectedIndexChanged"><asp:ListItem Value="-1">Choose</asp:ListItem>
                </asp:DropDownList>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Select a release:</strong>&nbsp; </font>
                <asp:DropDownList ID="ddRelease" AutoPostBack="True" AppendDataBoundItems="true" runat="server" onselectedindexchanged="DropDownList1_SelectedIndexChanged">    
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td style="height: 22px;" colspan="3">
                </td>
        </tr>
        <tr>
            <td colspan="3">
                <div id="divProject" runat="server" visible="false">
                    <font face="Verdana" size="2" style="text-align: left"><strong>&nbsp;Project:</strong></font>
                    <asp:CheckBoxList ID="cbProject" runat="server" RepeatColumns="4" 
                        RepeatDirection="Horizontal">
                    </asp:CheckBoxList>
                    &nbsp;<input type="checkbox" id="select_all" name="select_all" value="" onclick="javascript: selectAll()"> <font color="red"><b>Select All</b></font>
                </div>
            </td>
        </tr>
        <tr>
            <td style="width: 296px">
                &nbsp;</td>
            <td style="width: 324px; text-align: left;">
                <asp:Button ID="btnChart" runat="server" CssClass="btnChart" 
                    OnClientClick="javascript: submit_form()" 
                    style="text-align: center; cursor:hand" Text="Generate Chart" 
                    onclick="btnChart_Click" Visible="False"/>
            </td>
            <td>
                <asp:HiddenField ID="hdnProject" runat="server" />
            </td>
        </tr>
        <tr>
            <td colspan="3">          
                <asp:Literal ID="fcLiteral" runat="server"></asp:Literal>
                <div id="divtblproj" runat="server"></div>
            </td>
        </tr>
    </table>
</asp:Content>

